{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Using the cluster function to label clusters\n\nHere is an example where we generate some synthetic data, and then use the\ncluster function to get cluster labels, which we can then pass to the `hue`\nkwarg to color our points by cluster.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Code source: Andrew Heusser\n# License: MIT\n\n# import\nimport hypertools as hyp\nimport numpy as np\nfrom scipy.stats import multivariate_normal\n\n# simulate clusters\ncluster1 = np.random.multivariate_normal(np.zeros(3), np.eye(3), size=100)\ncluster2 = np.random.multivariate_normal(np.zeros(3)+3, np.eye(3), size=100)\ndata = np.vstack([cluster1, cluster2])\n\n# get cluster labels\ncluster_labels = hyp.cluster(data, n_clusters=2)\n\n# plot\nhyp.plot(data, '.', hue=cluster_labels)"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.12.4"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}